/*
 * MesoscopicNetworkBuilder.h
 *
 *  Created on: 21/11/2011
 *      Author: godinho
 */

#ifndef MESOSCOPICNETWORKBUILDER_H_
#define MESOSCOPICNETWORKBUILDER_H_

class Network;
class Case;

namespace localview {
class Network;
class LocalView;
class Edge;
class Link;
class Node;
}

class MesoscopicNetworkBuilder {
public:
	MesoscopicNetworkBuilder();
	virtual ~MesoscopicNetworkBuilder();

	Network* lvNetwork2Mesoscopic(localview::LocalView* lv, Case* c, int phaseId);

private:
	int calcTravelTime(localview::Edge* e);

	int getFlush(localview::Node* node, localview::Link* link, localview::Network* net);

    /**
     * Include node source.
     *
     * Rule to include a node source:
     *  Node sources will be included in all nodes which has only output
     *  edges. The generation rate will be calculated based on the output
     *  edge car flush.
     */
	void setupNodeSource(localview::Edge* edge, localview::Network* net);

private:
	Network* mMesNet;
};

#endif /* MESOSCOPICNETWORKBUILDER_H_ */
